<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="org.yak.core.web.ResultSet" %>
<%@page import="com.bkfm.framework.core.utils.QueryCall"%>
<%@page import="com.bkfm.framework.core.service.BkfmModelServiceUtils"%>
<%
String rwid = request.getParameter("rwid");
//查询汽车维修信息
BkfmModelServiceUtils.queryResultBySql("SELECT * FROM T_BKFM_CAR_MANAGER WHERE RWID='"+rwid+"'", new QueryCall(){
	public void callBackList(List<ResultSet> list)throws Exception{
		if(list !=null && !list.isEmpty()){
			request.setAttribute("repaireCar", list.get(0));
		}
	}
});
//查询维修配件清单
BkfmModelServiceUtils.queryResultBySql("SELECT A.PJMC,A.GG,A.DW,A.SL,A.DJ,A.JE,A.BZ FROM T_BKFM_WXPJQD A WHERE WXDBM='"+rwid+"'", new QueryCall(){
	public void callBackList(List<ResultSet> list)throws Exception{
		request.setAttribute("pjqdList", list);
	}
});
//查询维修项目
BkfmModelServiceUtils.queryResultBySql("SELECT A.WXXM, A.GSF,A.BZ ,A.JE FROM T_BKFM_WXXM A WHERE WXDBM='"+rwid+"'", new QueryCall(){
	public void callBackList(List<ResultSet> list)throws Exception{
		request.setAttribute("wxxmList", list);
	}
});
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta name="decorator" content="default" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>维修单</title>
	<%@include file="/common/head.jsp"%>
</head>
<body>
<style type="text/css">
table.gridtable {
	font-family: verdana,arial,sans-serif;
	font-size:11px;
	color:#333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
	width:778px;
}
table.gridtable th {
	text-align: center;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	font-size: 14px;
	background-color: #dedede;
}
table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	font-size: 14px;
	background-color: #ffffff;
}
</style>
<table class="gridtable">
  <tr>
    <td colspan="6" style="text-align:center;font-size:36px;">亮堂堂汽车维修有限公司</td>
  </tr>
  <tr>
    <th style="text-align:right;">单位名称(客户名称)</th>
    <td colspan="5">${repaireCar.KHMC }</td>
  </tr>
  <tr>
    <th style="text-align:right;">车牌号</th>
    <td>${repaireCar.CPHM }</td>
    <th style="text-align:right;">电话号码</th>
    <td>${repaireCar.DHHM }</td>
    <th style="text-align:right;">车辆品牌/型号</th>
    <td>${repaireCar.CLPP }</td>
  </tr>
  <tr>
    <th style="text-align:right;">行驶公里</th>
    <td>${repaireCar.XSGL }</td>
    <th style="text-align:right;">识别号</th>
    <td>${repaireCar.CLSBH }</td>
    <th style="text-align:right;">维修日期</th>
    <td>${repaireCar.WXRQ }</td>
  </tr>
</table>
<h2>所需维修项目</h2>
<table class="gridtable">
  <tr>
    <th width="37%">维修项目</th>
    <th width="10%">工时费</th>
    <th width="19%">金额</th>
    <th width="34%">备注</th>
  </tr>
  <c:forEach items="${wxxmList }" var="item">
  <tr>
    <td>${item.WXXM }</td>
    <td>${item.GSF }</td>
    <td>${item.JE }</td>
    <td>${item.BZ }</td>
  </tr>

  </c:forEach>
  <c:set var="wxxmSize" value="${5-fn:length(wxxmList)}"/>
  <c:if test="${wxxmSize>0 }">
  <c:forEach var="i" begin="1" end="${wxxmSize }" step="1">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </c:forEach>
  </c:if>
</table>
<h2>所用配件清单</h2>
<table class="gridtable">
  <tr>
    <th width="147">配件名称</th>
    <th width="75">规格</th>
    <th width="77">单位</th>
    <th width="71">数量</th>
    <th width="84">单价</th>
    <th width="102">金额</th>
    <th width="190">备注</th>
  </tr>
  <c:set var="total" value="0"/>
  <c:forEach items="${pjqdList }" var="list">
  <c:set value="${total + list.JE}" var="total" />
  <tr>
    <td>${list.PJMC }</td>
    <td>${list.GG }</td>
    <td>${list.DW }</td>
    <td>${list.SL }</td>
    <td>${list.DJ }</td>
    <td>${list.JE }</td>
    <td>${list.BZ }</td>
  </tr>
  </c:forEach>
  <c:set var="pjqdSize" value="${10-fn:length(pjqdList)}"/>
  <c:if test="${pjqdSize>0 }">
  <c:forEach var="i" begin="1" end="${pjqdSize }" step="1">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </c:forEach>
  </c:if>
  <tr>
    <td colspan="3">注意：为重物品请在将车辆交给本公司检查修理时，自行收起并保存，如有遗失，本公司怒不负责。</td>
    <td colspan="2">配件工时金额总计</td>
    <td colspan="2">${total }</td>
  </tr>
</table>

<table class="gridtable">
	<tr>
		<td width="361" style="border:0px;">服务热线：${sessionScope.CURRENT_USER.mobile }</td>
		<td width="66" style="border:0px;">客户签名</td>
		<td width="122" style="border:0px;">&nbsp;</td>
		<td width="209" style="border:0px;"><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u>年<u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u>月<u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u>日</td>
	</tr>
</table>
<script type="text/javascript">
Ext.onReady(function(){
	window.print();
});
</script>
</body>
</html>